//
//  UseAccount.swift
//  sinaWeibo
//
//  Created by apple on 15/11/19.
//  Copyright © 2015年 apple. All rights reserved.
//

import UIKit

class UseAccount: NSObject {
 /// 用于调用access_token，接口获取授权后的access_token
    var access_token: String?
    
 /// access_token的生命周期，单位秒数
    var expires_in: NSTimeInterval=0
 
  /// 当前授权用户的uid
    var uid: String?
    
 /// 用户的头像地址
    var avatar_large: String?
    
 /// 用户名
    var name: String?
    
    /**
     KVC设置初始值
     */
    init(dict:[String:AnyObject]){
    //super实例化
        super.init()
        
        setValuesForKeysWithDictionary(dict)
     
    }
    
    //过滤不用的字段
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    
//    override var description: String {
//        let keys = ["access_token","expires_in","uid","avatar_large","name"]
//        
//        return dictionaryWithValuesForKeys(keys).description
//    
//    }
    
//重写description 方法，将输出为字符串
    override var description: String {
        let keys = ["access_token","expires_in","uid","avatar_large","name"]
        return dictionaryWithValuesForKeys(keys).description
    }

}
